var express = require('express');
var router = module.exports = express.Router();

var _userDao = require('../dao/userDao');
var cookieSession = require('../util/base').cookieSession();

router.use(cookieSession);
var code= '123123';

// 更新密码
router.put('/',function (req,resp,next) {
	
	// 验证码不正确
	console.error(req.body);
	/*resp.json({
		hasError: true,
		errMsg: '操作失败!'
	});*/
	_userDao.updateLoginPassword(req, resp, next);
});

// 比对获取验证码
router.get('/:code',function (req,resp,next) {
	console.error(req.params);
	let param = req.params;
	if(param.code === code)
	{
		resp.json({
			hasError: false,
			errMsg: null
		});
		return;
	}
	resp.json({
		hasError: true,
		errMsg: '验证码错误!'
	})
});